﻿#region Imports
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using CommonUtilities.Util;
using DirectoryAnalyzer.Controls.Converters;
#endregion

namespace DirectoryAnalyzer.Controls
{
    /// <summary>
    /// PorgressBar showing progress % or detailed message
    /// </summary>
    public partial class StatusProgressBar : UserControl
    {
        #region Declarations
        VisibilityConverter convVisibility = new VisibilityConverter();
        #endregion

        #region Properties
        /// <summary>
        /// Progress % (as decimal)
        /// </summary>
        public double Progress
        {
            get { return prgProgress.Value; }
            set { prgProgress.Value = value; }
        }

        /// <summary>
        /// TRUE: Shows detailed progress
        /// </summary>
        public bool ShowDetails
        {
            get { return (bool)convVisibility.ConvertBack(txtbProgress.Visibility, null, "", null); }
            set { txtbProgress.Visibility = (Visibility)convVisibility.Convert(value, null, "", null); }
        }

        /// <summary>
        /// Progress details
        /// </summary>
        public string DetailedProgress
        {
            get { return txtbDetails.Text; }
            set { txtbDetails.Text = value; }
        }

        /// <summary>
        /// TRUE: Progress is pre-loading
        /// </summary>
        // Show progressive progress (moving bar) // RKD
        public bool IsLoading { get; set; }
        #endregion

        #region Constructors
        /// <summary>
        /// Default constructor
        /// </summary>
        public StatusProgressBar()
        {
            InitializeComponent();
            this.Language = XmlLanguage.GetLanguage(Utilities.DefaultCulture.Name);
        }
        #endregion
    }
}
